﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NLog.Extensions.Logging;
using NLog.LayoutRenderers;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sprout.NLog
{
    public static class SproutNLogExtensions
    {
        public static void AddSproutNLog(this IServiceCollection services,
            IConfiguration configuration,string configName = "NLog.config")
        {
            services.AddLogging(m => {
                m.AddNLog(configName);
            });
            //加入自定义属性
            LayoutRenderer.Register<AppNameLayoutRenderer>("app_name");

        }
    }
}
